/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package east2west.service;

import east2west.dao.CarDAO;
import east2west.dao.CarDetailDAO;
import east2west.dao.CarModelDAO;
import east2west.dao.CarTypeDAO;
import east2west.dto.CarDetailDTO;
import east2west.dto.CarModelDTO;
import east2west.dto.CarTypesDTO;
import east2west.dto.CarsDTO;
import java.util.ArrayList;

/**
 *
 * @author anhtuan
 */
public class CarService {

    CarDAO dao = new CarDAO();
    CarModelDAO modelDAO = new CarModelDAO();
    CarTypeDAO typeDAO = new CarTypeDAO();
    CarDetailDAO detailDAO = new CarDetailDAO();

    public ArrayList<CarsDTO> readByAll() {
        return dao.readByAll();

    }

    public ArrayList<CarsDTO> readByTopCar(int top) {
        return dao.readByTopCar(top);
    }

    public CarsDTO findById(int id) {
        return dao.findByid(id);
    }

    public ArrayList<CarsDTO> readByOtherCarId(int id) {
        return dao.readByOtherCarId(id);
    }

    public ArrayList<CarsDTO> findByModeId(int id) {
        return dao.findByModeId(id);
    }

    public ArrayList<CarsDTO> findByTypeId(int id) {
        return dao.findByTypeId(id);
    }

    public ArrayList<CarsDTO> findByAirConditional(byte air) {
        return dao.findByAirConditional(air);
    }

    public ArrayList<CarsDTO> findBySeatQty(int qty) {
        return dao.findBySeatQty(qty);
    }

    public ArrayList<CarsDTO> findByDTO(CarsDTO dto) {
        return dao.findByDTO(dto);
    }

    public ArrayList<CarModelDTO> readByAllModel() {
        return modelDAO.readByAll();
    }

    public ArrayList<CarTypesDTO> readByAllType() {
        return typeDAO.readByAll();
    }

    public int createCar(CarsDTO dto) {
        return dao.create(dto);
    }

    public boolean createCarDetail(CarDetailDTO dto) {
        return detailDAO.create(dto);
    }

    public boolean updateCar(CarsDTO dto) {
        return dao.update(dto);
    }

    public boolean deleteCar(int id) {
        return dao.delete(id);
    }
}
